package com.shao.pojo;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: SJP
 * Date: 2021/5/19
 * Time: 20:59
 * Description: No Description
 */
public class Page<T> {
    public static final Integer PAGE_SIZE=4;
    //当前页码
    private Integer pageNn;
    //总页码
    private Integer pageTotal;
    //总记录条数
    private Integer pageTotalCount;
    //每页显示的数据数
    private Integer pageSize = PAGE_SIZE;
    //当前页显示数据
    private List<T>items ;
    //分页请求地址
    private String url;


    public Page() {
    }

    public Page(Integer pageNn, Integer pageTotal, Integer pageTotalCount, Integer pageSize, List<T> items, String url) {
        this.pageNn = pageNn;
        this.pageTotal = pageTotal;
        this.pageTotalCount = pageTotalCount;
        this.pageSize = pageSize;
        this.items = items;
        this.url = url;
    }

    /**
     * 获取
     * @return pageNn
     */
    public Integer getPageNn() {
        return pageNn;
    }

    /**
     * 设置
     * @param pageNn
     */
    public void setPageNn(Integer pageNn) {
        //数据边界的检查
        if(pageNn<1){
            pageNn=1;
        }
        if(pageNn>pageTotal){
            pageNn=pageTotal;
        }
        this.pageNn = pageNn;
    }

    /**
     * 获取
     * @return pageTotal
     */
    public Integer getPageTotal() {
        return pageTotal;
    }

    /**
     * 设置
     * @param pageTotal
     */
    public void setPageTotal(Integer pageTotal) {
        this.pageTotal = pageTotal;
    }

    /**
     * 获取
     * @return pageTotalCount
     */
    public Integer getPageTotalCount() {
        return pageTotalCount;
    }

    /**
     * 设置
     * @param pageTotalCount
     */
    public void setPageTotalCount(Integer pageTotalCount) {
        this.pageTotalCount = pageTotalCount;
    }

    /**
     * 获取
     * @return pageSize
     */
    public Integer getPageSize() {
        return pageSize;
    }

    /**
     * 设置
     * @param pageSize
     */
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    /**
     * 获取
     * @return items
     */
    public List<T> getItems() {
        return items;
    }

    /**
     * 设置
     * @param items
     */
    public void setItems(List<T> items) {
        this.items = items;
    }

    /**
     * 获取
     * @return url
     */
    public String getUrl() {
        return url;
    }

    /**
     * 设置
     * @param url
     */
    public void setUrl(String url) {
        this.url = url;
    }

    public String toString() {
        return "Page{PAGE_SIZE = " + PAGE_SIZE + ", pageNn = " + pageNn + ", pageTotal = " + pageTotal + ", pageTotalCount = " + pageTotalCount + ", pageSize = " + pageSize + ", items = " + items + ", url = " + url + "}";
    }
}
